<div class="vista_toolbar">
  <ul>
    <%= toolbar_add 'tarjouspyyntö', 'quote_requests', customer %>
    <%= toolbar_delete_selected 'quote_requests' %>
  </ul>
</div>
<%form_remote_tag :url => destroy_selected_quote_requests_url, :confirm => 'Haluatko varmasti poistaa tarjouspyynnöt?', :before => "spinnerOn('quote_requests');", :complete => "spinnerOff('quote_requests');", :method => :delete, :html => { :id => 'quote_requests_form'} do %><%if customer.quote_requests.empty? %>
    <div class="container">
      Tarjouspyyntöjä ei ole.
    </div>
  <%else %>
    <div class="scrollable" style="height:15em">
      <%customer.quote_requests.each do |quote_request| %>
        <div class="container">
          <div style="float:right">
            <%=icon_edit 'quote_requests', quote_request %>
            <%=checkbox_delete_selected 'quote_requests', quote_request.id %>
          </div>
          <%=content_tag :div, "#{quote_request.description} / #{quote_request.created_on}", :class => 'description', :onclick => visual_effect(:toggle_blind, "quote_request_details_" + quote_request.id.to_s, :duration => 1.0) %>
          <br/>
          <div id="quote_request_details_<%=quote_request.id%>">
            <p>
              <%quote_request.documents.each do |document| %>
                <%=link_to document.filename, {:controller => 'documents', :action => 'view', :id => document}, :popup => true, :html => {:class => 'file'} %>
                <% if authorized? 'quote_requests', 'remove_document' %>
                  <%=link_to_remote image_tag('cross.png', :title => 'Poista'), :url => {:controller => 'quote_requests', :action => 'remove_document', :id => quote_request, :document => document}, :confirm => 'Haluatko varmasti poistaa dokumentin?' %>
                <% end %>
                <br/>
              <%end %>
            </p>
            <br/>
            <% if authorized? 'quote_requests', 'new_document' %>
              <%= link_to_remote '[Lisää tiedosto...]',  :url=> {:controller => 'quote_requests', :action => 'new_document', :id => quote_request} %><br/>
            <% end %>
          </div>
          <div style="clear:both">
          </div>
        </div>
      <%end %>
    </div>
  <%end %>
<%end %>